<?php
namespace app\admin\form;

use app\common\loglic\Form;

class Menu extends Form
{
    public function items($data=[])
    {
        return [
            'menu_id' => [
                'type'        => 'hidden',
                'value'       => $data['menu_id'],
            ],
            'menu_parent' => [
                'type'        => 'select',
                'value'       => $data['menu_parent'],
                'option'      => model('common/Menu','loglic')->optionLevel(0),
                'required'    => true,
                'title'       => '父级菜单',
                'class_row'   => 'col-2 mb-3',
            ],
            'menu_group' => [
                'type'        => 'select',
                'value'       => intval($data['menu_group']),
                'option'      => model('common/Attr','loglic')->group(),
                'title'       => '菜单分组',
                'class_row'   => 'col-2 mb-3',
            ],
            'menu_status' => [
                'type'        => 'select',
                'value'       => $data['menu_status'],
                'option'      => model('common/Attr','loglic')->status(),
                'required'    => true,
                'title'       => '显示状态',
                'class_row'   => 'col-2 mb-3',
            ],
            'menu_target' => [
                'type'        => 'select',
                'value'       => $data['menu_target'],
                'option'      => model('common/Attr','loglic')->target(),
                'title'       => '打开方式',
                'class_row'   => 'col-2 mb-3',
            ],
            'menu_weight' => [
                'type'        => 'number',
                'value'       => intval($data['menu_weight']),
                'required'    => true,
                'title'       => '排序权重',
                'class_row'   => 'col-2 mb-3',
                'class_input' => 'form-control form-control-sm text-center',
            ],
            'menu_active' => [
                'type'        => 'text',
                'value'       => $data['menu_active'],
                'required'    => false,
                'title'       => '高亮属性',
                'class_row'   => 'col-2 mb-3',
                'class_label' => 'form-label',
            ],
            'menu_name' => [
                'type'        => 'text',
                'value'       => $data['menu_name'],
                'required'    => true,
                'title'       => '菜单名称',
                'maxlength'   => 20,
                'class_row'   => 'col-6 mb-3',
            ],
            'menu_url' => [
                'type'        => 'text',
                'value'       => $data['menu_url'],
                'required'    => true,
                'title'       => '网址链接',
                'class_row'   => 'col-6 mb-3',
            ],
            'menu_image' => [
                'type'        => 'image',
                'value'       => $data['menu_image'],
                'required'    => false,
                'title'       => '菜单图片',
                'class_row'   => 'col-6 mb-3',
            ],
            'menu_icon' => [
                'type'        => 'text',
                'value'       => $data['menu_icon'],
                'required'    => false,
                'title'       => '菜单图标',
                'class_row'   => 'col-6 mb-3',
            ],
            'menu_info' => [
                'type'        => 'text',
                'value'       => $data['menu_info'],
                'required'    => false,
                'title'       => '菜单描述',
                'class_row'   => 'col-12 mb-4',
                'class_label' => 'form-label',
            ],
        ];
    }
}